/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lesson7_2;

import java.util.Vector;

/**
 *
 * @author netcracker
 */
public class Lesson6 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IncompatibleVectorSizesException {

        //ADAPTER
        System.out.println("ADAPTER!");
        IVector iv = Vectors.getAdaptedJVector(new Vector());
        iv.add(1.2);
        iv.add(131);
        System.out.println(iv.toString());


        //PROXY
        System.out.println("PROXY");
        IVector iv1 = Vectors.getProtectedVector(new ArrayVector(5));
        iv1.add(12.2);
        for (Double object : iv1) {
            System.out.println(object);
        }

        //OBSERVER
        System.out.println("\nOBSERVER");

        ArrayVector av = new ArrayVector(5);
        Observer o1 = new VectorObserver();
        //Observer o2 = new VectorObserver();
        av.addObserver(o1);
        //av.addObserver(o2);

        av.add(123);
        av.set(95, 1);
        av.fill(iv1);

        //WARNING uncaught EXCEPTION
        av.get(1000);


        IVector av1 = new ArrayVector(5);
        ArrayVector av2 = new ArrayVector(10);

        System.out.println(av1.isSame(av2));



    }
}
